home *** CD-ROM | disk | FTP | other *** search
- Path: news.sunquest.com!news
- From: Dean Schulze <schulze@vega.lpl.arizona.edu>
- Newsgroups: comp.lang.c++,comp.lang.fortran
- Subject: Re: Calling Fortran in C++
- Date: 8 Jan 1996 17:05:31 GMT
- Organization: Sunquest Information Systems, Inc.
- Message-ID: <4crisr$v3u@odin.sunquest.com>
- References: <4cr87l$794$1@mhafc.production.compuserve.com>
- NNTP-Posting-Host: dwspc.sunquest.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.2 (Windows; U; 32bit)
-
-
- Steve Harris <100016.2166@CompuServe.COM> wrote:
-
- > Can anyone provide me with a 'simple' example, with source
- > code and an 'idiots' step guide, on how to call some FORTRAN
- > code from MS VISUAL C++.
- > ..
- > The more I look at the examples in the book the darker the
- > world appears to become!
-
- I recently began moving my C++/C/F77 code from
- SunOS to Windows NT using VC++4.0/PowerStation4.0. Before
- doing this I considered using gcc/g77 and chose the
- Microsoft compilers after being assured by MS that mixed
- language programming would work with their compilers.
- After working with their compilers and reading their
- documentation I now see that their claims to support
- legacy code with mixed language programming are deceitful.
-
- In order to mix Fortran and C/C++ with Microsoft
- compilers you must wrap your Fortran subroutine/function
- definitions in Microsoft specific extensions. This means
- a lot of recoding, adding non-standard code to my standard
- code. What makes this even worse is that Powerstation
- Fortran apparently will not invoke the C Preprocessor
- so I cannot do something like
-
- #ifdef MSFORTRAN
-
- (Microsoft abortions here)
-
- #endif
-
- so that I can move the code to a non-Microsoft Fortran
- compiler.
-
- Because of this stupidity by Microsoft I STRONGLY
- RECOMMEND AGAINST DOING MIXED LANGUAGE PROGRAMMMING
- WITH MICROSOFT COMPILERS. You can get it to work if you
- write enough MS specific code, but there is no good reason
- to do this. Consider using gcc/g77 instead under WinNT/95
- or switching to Linux.
-
- Mixed language programming is inherently non-portable,
- but it is not hard to do and there is no good reason for
- the stupidity that Microsoft has introduced.
-
- Microsoft might end up making a Linux user out of
- me yet.
-
- Dean Schulze
-
-
- P.S. I have written a tutorial introduction to mixed
- language programming (C++/C/Fortran), including example
- code, which I'll be glad to send to anyone who wants it.
- Just e-mail me.
-
- My examples are work with Sun and SGI compilers,
- and will probably work without modifications for
- gcc/g77 on Win32. My examples show how easy and clean
- mixed language programming is. No Microsoft-like abortions
- are needed, and they should be avoided.
-
-
-
-